package com.hsjk.szwj.module.official.dal.mysql.video;

import com.hsjk.szwj.framework.common.pojo.PageResult;
import com.hsjk.szwj.framework.mybatis.core.mapper.BaseMapperX;
import com.hsjk.szwj.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hsjk.szwj.module.official.controller.admin.video.vo.AdminOfficialWebsiteVideoPageReqVO;
import com.hsjk.szwj.module.official.controller.app.video.vo.AppOfficialWebsiteVideoListReqVO;
import com.hsjk.szwj.module.official.dal.dataobject.video.OfficialWebsiteVideoDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/07/31 19:47
 **/
@Mapper
public interface IOfficialWebsiteVideoMapper extends BaseMapperX<OfficialWebsiteVideoDO> {
    default List<OfficialWebsiteVideoDO> selectList(AppOfficialWebsiteVideoListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<OfficialWebsiteVideoDO>()
                .likeIfPresent(OfficialWebsiteVideoDO::getVideoName, reqVO.getVideoName()));
    }

    default PageResult<OfficialWebsiteVideoDO> selectPage(AdminOfficialWebsiteVideoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OfficialWebsiteVideoDO>()
                .likeIfPresent(OfficialWebsiteVideoDO::getVideoName, reqVO.getVideoName())
                .orderByDesc(OfficialWebsiteVideoDO::getId));
    }
}
